<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ include file="session-check.jsp"%>
<!DOCTYPE html>
<html lang="zh-cn">
    <head>
        <meta charset="utf-8" />
        <meta name="description" content="对网页的一段概括性描述"/>
        <meta name="keywords" content="关键字1,关键字2,关键字3..."/>
        <meta name="renderer" content="webkit">
        <title>Hiring-企业登录</title>
        <link rel="shortcut icon" href="<%=request.getContextPath()%>/static/common/images/favicon.ico"/>
        <link rel="stylesheet" href="<%=request.getContextPath()%>/static/common/vendor/bootstrap/css/bootstrap.min.css" />
        <link rel="stylesheet" href="<%=request.getContextPath()%>/static/company/styles/login.css" />
	    <!--[if lt IE 9]>
	      <script src="http://cdn.bootcss.com/html5shiv/3.7.0/html5shiv.js"></script>
	      <script src="http://cdn.bootcss.com/respond.js/1.4.2/respond.min.js"></script>
	    <![endif]-->
    </head>
    <body>
	 	<div class="container" >
	 	  <c:if test="${! empty param.result }">
			<div class="alert alert-warning alert-dismissible fade in" role="alert">
			   <button type="button" class="close" data-dismiss="alert"><span aria-hidden="true">×</span><span class="sr-only">Close</span></button>
			   <strong>修改密码失败！</strong>
			</div>
	 	  </c:if>
	      <form class="form-signin" role="form" action="<%=request.getContextPath() %>/CompanyServlet?command=updatepassword&id=${sessionScope.companyEntity.id}" 
	      			method="post" onsubmit="return validate();">
	        <h2 class="form-signin-heading">修改密码</h2>
	      	 原始密码:<input type="password" id="fname" name="oldpassword" onblur="myFunction()"><span id="oldpasswordend"></span><br>      <!-- onblur="myFunction()"光标移开触发函数 -->
	      	 新密码:<input type="password" id="newpassword" name="newpassword"><br>
	        <button class="btn btn-lg btn-primary " type="submit">修改</button><!-- btn-block -->
	        <button type="button" class="btn btn-default" onclick="return history.back();">返 回</button>
	      </form>
	      
	    </div>
	    
		<script src="<%=request.getContextPath()%>/static/common/vendor/jquery.min.js"></script>
		<script src="<%=request.getContextPath()%>/static/common/vendor/bootstrap/js/bootstrap.min.js"></script>
		<script src="<%=request.getContextPath()%>/static/common/vendor/layer/layer.js"></script>
		<script src="<%=request.getContextPath()%>/static/common/vendor/nice-validator-1.0.7/dist/jquery.validator.min.js?local=zh-CN"></script>
		<script>
			function myFunction(){
				var result = true;
				var fname = document.getElementById('fname').value;
				var sesseionpassword = ${sessionScope.companyEntity.password};
				if(sesseionpassword == fname){
					document.getElementById('oldpasswordend').innerHTML = '<font color="green">正确</font>'
				}else{
					document.getElementById('oldpasswordend').innerHTML = '<font color="red">你输入的密码不正确</font>'
					result = false;
				}
				return result;
			}
			function validate(){
				var result = true;
				var fname = document.getElementById('fname').value;
				var sesseionpassword = ${sessionScope.companyEntity.password};
				if(sesseionpassword == fname){
					document.getElementById('oldpasswordend').innerHTML = '<font color="green">正确</font>'
				}else{
					document.getElementById('oldpasswordend').innerHTML = '<font color="red">你输入的密码不正确</font>'
					result = false;
				}
				return result;
			}
		</script>
		<!-- location = '<%=request.getContextPath()%>/CompanyServlet?command=oldpasswordSelect&id=${sessionScope.companyEntity.id}'; -->
    </body>
</html>
